﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MobSoft.SoftwareItemsRef;

namespace MobSoft
{
    public partial class MainPage : UserControl
    {
        ServiceClient objRemote = new ServiceClient();
        public MainPage()
        {
            InitializeComponent();
            objRemote.GetTop10Completed += new EventHandler<GetTop10CompletedEventArgs>(objRemote_GetTop10Completed);
            objRemote.GetTop10Async("-1");
        }
        private void TIHome_GotFocus(object sender, RoutedEventArgs e)
        {
            objRemote.GetTop10Async("-1");
            Top10Local.Visibility = Visibility.Visible;
        }

        private void TIHome_LostFocus(object sender, RoutedEventArgs e)
        {
            Top10Local.Visibility = Visibility.Collapsed;
        }
        private void objRemote_GetTop10Completed(object sender, GetTop10CompletedEventArgs e)
        {
            List<MobSoft.SoftwareItemsRef.Top10> resultList = e.Result.ToList();
            Top10Local.DGTop10.ItemsSource = e.Result;
        }

        private void TISymbian_GotFocus(object sender, RoutedEventArgs e)
        {
            objRemote.GetTop10Async("2");
            Top10Local.Visibility = Visibility.Visible;
        }

        private void TIJava_GotFocus(object sender, RoutedEventArgs e)
        {
            objRemote.GetTop10Async("3");
            Top10Local.Visibility = Visibility.Visible;
        }

    }
}
